package com.jokelandave.poc.server.domain;

import java.util.List;

import javax.persistence.Id;

import com.googlecode.objectify.Key;

public class Profile {

	@Id
	Long id;
	
	/**
	 * This should be set via the getUserId() method called from a com.google.appengine.api.users.User
	 * this provides a link between the google user and SPB Profile
	 */
	String googleUserId;
	
	int cred;
	
	List<Key<Team>> favortieTeams;
	
	Profile()
	{
	}
	
	public Profile(String googleUserId)
	{
		this.googleUserId = googleUserId;
		this.cred = 0;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + cred;
		result = prime * result
				+ ((favortieTeams == null) ? 0 : favortieTeams.hashCode());
		result = prime * result
				+ ((googleUserId == null) ? 0 : googleUserId.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Profile other = (Profile) obj;
		if (cred != other.cred)
			return false;
		if (favortieTeams == null) {
			if (other.favortieTeams != null)
				return false;
		} else if (!favortieTeams.equals(other.favortieTeams))
			return false;
		if (googleUserId == null) {
			if (other.googleUserId != null)
				return false;
		} else if (!googleUserId.equals(other.googleUserId))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	public Long getId()
	{
		return id;
	}
	public String getGoogleUserId() {
		return googleUserId;
	}

	public void setGoogleUserId(String googleUserId) {
		this.googleUserId = googleUserId;
	}

	public int getCred() {
		return cred;
	}

	public void setCred(int cred) {
		this.cred = cred;
	}

	public List<Key<Team>> getFavortieTeams() {
		return favortieTeams;
	}

	public void setFavortieTeams(List<Key<Team>> favortieTeams) {
		this.favortieTeams = favortieTeams;
	}
}
